package com.ebraga.trackerclub.android.manager.api;

import com.ebraga.trackerclub.android.exception.BackofficeDBConnectionException;
import com.ebraga.trackerclub.android.exception.dao.BackofficeConnectionWebServicesException;
import com.ebraga.trackerclub.android.exception.dao.BackofficeInvalidURLWebServicesException;
import com.ebraga.trackerclub.android.exception.dao.BackofficeWebServicesException;
import com.ebraga.trackerclub.android.exception.manager.BackofficeInvalidSessionManagerException;
import com.ebraga.trackerclub.android.exception.manager.BackofficeManagerException;
import com.ebraga.trackerclub.android.util.enumeration.AndroidConfigurationParameterName;


/**
 * Provides methods to manage data synchronization. 
 */
public interface SyncDataManager {
	
	/**
	 * Performs data synchronization between Android and DMS.
	 * 
	 * @throws BackofficeInvalidSessionManagerException if a session problem occurs
	 * @throws BackofficeDBConnectionException if a database connection occurs
	 * @throws BackofficeWebServicesException if a web service error occurs
	 * @throws BackofficeManagerException if another error occurs
	 */
	void syncData() throws BackofficeManagerException, BackofficeInvalidSessionManagerException, 
		BackofficeDBConnectionException, BackofficeWebServicesException;

	/**
	 * Performs parameters synchronization between Android and DMS.
	 * 
	 * @throws BackofficeWebServicesException if a web service error occurs
	 * @throws BackofficeInvalidURLWebServicesException
	 * @throws BackofficeConnectionWebServicesException
	 * @throws BackofficeDBConnectionException if a database connection occurs
	 * @throws BackofficeManagerException if another error occurs
	 * @see AndroidConfigurationParameterName
	 */
	void syncParameters() throws BackofficeWebServicesException,
			BackofficeInvalidURLWebServicesException,
			BackofficeConnectionWebServicesException,
			BackofficeDBConnectionException, BackofficeManagerException;

	/**
	 * Performs ranking synchronization between Android and DMS.
	 * @throws BackofficeWebServicesException
	 * @throws BackofficeInvalidURLWebServicesException
	 * @throws BackofficeConnectionWebServicesException
	 * @throws BackofficeDBConnectionException
	 * @throws BackofficeManagerException
	 */
	public void syncRanking() throws BackofficeWebServicesException,
	BackofficeInvalidURLWebServicesException,
	BackofficeConnectionWebServicesException,
	BackofficeDBConnectionException, BackofficeManagerException;	

	/**
	 * Returns <code>true</code> if it is time to performs a sync data, otherwise returns <code>false</code>.
	 * 
	 * @return <code>true</code> if it is time to performs a sync data, otherwise returns <code>false</code>.
	 * @throws BackofficeDBConnectionException if a database connection occurs
	 * @throws BackofficeManagerException if another error occurs
	 */ 
	boolean isTimeToSyncData() throws BackofficeDBConnectionException, BackofficeManagerException;
	
}
